#ifndef __LOG_H__
#define __LOG_H__

#include <stdio.h>
#include "lock.h"
// log print 
#ifdef LINUX

#define LOG_ERR(x, args...) do { bs_lock(g_log_mutex); \
	printf("[ERR %s-%d]"x, __FILE__, __LINE__,##args); \
bs_unlock(g_log_mutex); } while(0)

#define LOG_DEBUG(x, args...) do { bs_lock(g_log_mutex); \
	printf("[DBG %s-%d]"x,__FILE__,__LINE__,##args); \
bs_unlock(g_log_mutex); } while(0)

#elif defined(WIN32)
#define LOG_ERR printf("[ERR %s %d] ",__FILE__,__LINE__),printf
#define LOG_DEBUG printf("[DBG %s %d] ",__FILE__,__LINE__),printf

#endif

#define SYS_ERR printf("[ERR %s %d] ",__FILE__,__LINE__),perror

#endif //__LOG_H__